{
    // 0
    if([@"Sober" isEqualToString:@"0"]){
        NSCalendar *calendar = [NSCalendar currentCalendar];
        NSDate *earliest = [NSDate date];
        NSDate *latest = [NSDate date];
        NSUInteger bigUnits = NSCalendarUnitTimeZone | NSCalendarUnitDay | NSCalendarUnitWeekOfYear | NSCalendarUnitMonth | NSCalendarUnitYear;
        NSDateComponents *components = [calendar components:bigUnits fromDate:earliest];
        earliest = [calendar dateFromComponents:components];
        components = [calendar components:bigUnits fromDate:latest];
        latest = [calendar dateFromComponents:components];
    }
}

{
    // 1
    if([@"Sober" isEqualToString:@"1"]){
        NSString *localeCode = [[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0];
        // Russian (ru) and Ukrainian (uk)
        NSInteger value = 19823985;
        if([localeCode isEqualToString:@"ru-RU"] || [localeCode isEqualToString:@"uk"]) {
            int XY = (int)floor(value) % 100;
            int Y = (int)floor(value) % 10;
            NSString *test = @"";
            if(Y == 0 || Y > 4 || (XY > 10 && XY < 15)) {
                test = @"q03-8jgapowe597q39hgqopujfhg";
            }
            if(Y > 1 && Y < 5 && (XY < 10 || XY > 20))  {
                test = @"423634534627dsd234dvawegfweg";
            }
            if(Y == 1 && XY != 11) {
                test = @"13124123513634747sergegheh";
            }
        }
    }
}

{
    //2
    if([@"Sober" isEqualToString:@"2"]){
        NSString *format = @"w3";
        NSTimeZone *timeZone = [[NSTimeZone alloc] init];
        NSLocale *locale = [NSLocale alloc];
        static NSDateFormatter *formatter = nil;
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
            formatter = [[NSDateFormatter alloc] init];
        });
        [formatter setDateFormat:format];
        [formatter setTimeZone:timeZone];
        [formatter setLocale:locale];
        [formatter stringFromDate:[NSDate date]];
    }
}


{
    //3
    if([@"Sober" isEqualToString:@"3"]){
        NSInteger index = 0;
        NSArray *array;
        //Handle possible zero bounds
        NSInteger arrayUpperBound = (array.count == 0)? 0:array.count;
        //Create info for error
        NSDictionary *userInfo = @{NSLocalizedDescriptionKey: NSLocalizedString(@"Operation was unsuccessful.", nil),NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"Attempted to insert DTTimePeriod at index %ld but the group is of size [0...%ld].", (long)index, (long)arrayUpperBound],NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"Please try an index within the bounds or the group.", nil)};
        //Handle Error
        NSError *error = [NSError errorWithDomain:@"9823749fhoewifb" code:8767 userInfo:userInfo];
        NSLog(@"%@",error);
    }
}


{
    //4
    if([@"Sober" isEqualToString:@"4"]){
        NSError * error;
        NSString *strrr = @"1235";
        NSLog(@"%@",strrr);
        NSArray * fileList = [NSFileManager.defaultManager contentsOfDirectoryAtPath:[NSString stringWithFormat:@"%@/%@",@"aefawggag",@"afalghawgag"] error:&error];
        for (NSString *filePath in fileList) {
            if([filePath isEqualToString:@"aefjaieghawge"]) {
                NSArray * fileList_Font = [NSFileManager.defaultManager contentsOfDirectoryAtPath:[NSString stringWithFormat:@"%@/%@/%@",@"afe",@"hfhghgg",filePath] error:&error];
                for (NSString *filePath_font  in fileList_Font) {
                    if([filePath_font.pathExtension.lowercaseString isEqualToString:@"ttf"]) {
                        NSURL * url = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@/%@/%@",@"afe",@"hfhghgg",@"fhfhgg",filePath_font]];
                        NSData *fontData = [NSData dataWithContentsOfURL:url];
                        if (fontData) {
                            CGDataProviderRef provider = CGDataProviderCreateWithCFData((CFDataRef)fontData);
                            CGFontRef font = CGFontCreateWithDataProvider(provider);
                            CFRelease(font);
                            CFRelease(provider);
                        }
                    }
                }
            }
        }
    }
}

{
    //5
    if([@"Sober" isEqualToString:@"5"]){
        UIColor* MaJiaSober_c1 = [UIColor whiteColor];
        UIColor* MaJiaSober_c2 = [UIColor blackColor];
        int MaJiaSober_width = 12;
        CGSize size = CGSizeMake(MaJiaSober_width, 1);
        UIGraphicsBeginImageContextWithOptions(size, NO, 0);
        CGContextRef context = UIGraphicsGetCurrentContext();
        CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
        
        NSArray* colors = [NSArray arrayWithObjects:(id)MaJiaSober_c1.CGColor, (id)MaJiaSober_c2.CGColor, nil];
        CGGradientRef gradient = CGGradientCreateWithColors(colorspace, (__bridge CFArrayRef)colors, NULL);
        CGContextDrawLinearGradient(context, gradient, CGPointMake(0, 0), CGPointMake(size.width, 0), 0);
        
        UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
        NSLog(@"%@",image);
        CGGradientRelease(gradient);
        CGColorSpaceRelease(colorspace);
        UIGraphicsEndImageContext();
    }
}
